NAME := board_ok1052c

$(NAME)_MBINS_TYPE := kernel
$(NAME)_VERSION    := 1.0.0
$(NAME)_SUMMARY    := configuration for FORLINX FET1052-C board
MODULE             := 1052
HOST_ARCH          := Cortex-M7
HOST_MCU_FAMILY    := mcu_mimxrt1052impl

$(NAME)_COMPONENTS += $(HOST_MCU_FAMILY) kernel_init fatfs

CONFIG_SYSINFO_PRODUCT_MODEL := ALI_AOS_FET1052_C
CONFIG_SYSINFO_DEVICE_NAME   := FET1052

GLOBAL_DEFINES += SKIP_SYSCLK_INIT
GLOBAL_DEFINES += QSPI_BOOT
GLOBAL_DEFINES += XIP_EXTERNAL_FLASH=1
GLOBAL_DEFINES += XIP_BOOT_HEADER_ENABLE=1
GLOBAL_DEFINES += KV_CONFIG_TOTAL_SIZE=0x4000
GLOBAL_DEFINES += KV_CONFIG_BLOCK_SIZE_BITS=12
GLOBAL_DEFINES += CONFIG_AOS_FATFS_SUPPORT_MMC


GLOBAL_CFLAGS += -DSYSINFO_PRODUCT_MODEL=\"$(CONFIG_SYSINFO_PRODUCT_MODEL)\"
GLOBAL_CFLAGS += -DSYSINFO_DEVICE_NAME=\"$(CONFIG_SYSINFO_DEVICE_NAME)\"
GLOBAL_CFLAGS += -DSYSINFO_ARCH=\"$(HOST_ARCH)\"
GLOBAL_CFLAGS += -DSYSINFO_MCU=\"$(HOST_MCU_FAMILY)\"
GLOBAL_CFLAGS += -DCPU_MIMXRT1052CVL5B
GLOBAL_CFLAGS += -DFSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE

GLOBAL_INCLUDES += board \
                   board/sdmmc \
                   boot \
                   aos \
                   startup

$(NAME)_SOURCES := board/board.c                                 \
                   board/clock_config.c                          \
                   board/pin_mux.c                               \
                   board/flexspi_norflash.c                      \
                   board/fsl_phy.c                               \
                   board/fsl_wm8960.c                            \
                   board/sdmmc/fsl_sd.c                          \
                   board/sdmmc/fsl_sdmmc_common.c                \
                   board/sdmmc/fsl_sdmmc_event.c                 \
                   board/sdmmc/fsl_sdmmc_host.c                  \
                   board/rtc.c                                   \
                   boot/fsl_flexspi_nor_boot.c \
                   boot/fsl_flexspi_nor_flash.c \
                   aos/soc_init.c \
                   aos/board_partition.c \
                   startup/system_MIMXRT1052.c 
#depends on sal module if select sal function via build option "AOS_NETWORK_SAL=y"
AOS_NETWORK_SAL    ?= n
ifeq (y,$(AOS_NETWORK_SAL))
$(NAME)_COMPONENTS += sal device_sal_n720
else
$(NAME)_COMPONENTS += lwip yloop
endif


ifeq ($(COMPILER), armcc)
$(NAME)_SOURCES    += startup/keil/startup_MIMXRT1052.s
$(NAME)_LINK_FILES := startup/keil/startup_MIMXRT1052.o
GLOBAL_LDFLAGS += -L --remove --keep=*(.boot_hdr.ivt) --keep=*(.boot_hdr.boot_data) --keep=*(.boot_hdr.conf) --scatter=../../../../board/ok1052c/startup/keil/MIMXRT1052xxxxx_flexspi_nor_sdram.scf
else ifeq ($(COMPILER), iar)
$(NAME)_SOURCES    += startup/iar/startup_MIMXRT1052.s
GLOBAL_LDFLAGS += --config board/ok1052c/startup/keil/MIMXRT1052xxxxx_flexspi_nor_sdram.icf
else
GLOBAL_ASMFLAGS += -D__STARTUP_INITIALIZE_NONCACHEDATA
GLOBAL_ASMFLAGS += -D__STARTUP_CLEAR_BSS
$(NAME)_SOURCES    += startup/gcc/startup_MIMXRT1052.S
GLOBAL_LDFLAGS += -T board/ok1052c/startup/gcc/MIMXRT1052xxxxx_flexspi_nor_sdram.ld
endif

hardware_platform_name := ok1052c

# Keil project support
$(NAME)_KEIL_VENDOR = NXP
$(NAME)_KEIL_DEVICE = MIMXRT1052CVL5B
